home *** CD-ROM | disk | FTP | other *** search
- Path: castle.nando.net!news
- From: Caius Martius <caius@nando.net>
- Newsgroups: comp.lang.c++
- Subject: Re: Operator overload problem!
- Date: Tue, 19 Mar 1996 13:54:52 -0800
- Organization: Nando.net
- Message-ID: <314F2D2C.6AB5@nando.net>
- References: <DoIn1z.Gou@latcs1.lat.oz.au>
- NNTP-Posting-Host: grail1307.nando.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win95; I; 16bit)
-
- Gregary J Boyles wrote:
- >
- > I am trying to overload the << but I get the syntax errors : friends must be functions or
- > classes, 'ostream' cannot start a parameter declaration, 'Address::operator <<(int &,Address &)'
- > must be declared at the first set of astericks and declaration syntax error at the second set.
- >
- > What the #$%& is it on about? I copied the operator overload function directly out of a program
- > which compiles and runs so why all of a sudden won't the bloody compiler accept it?
-
- > // Operator overloads
- >
- > ***************************************************************
- > *
- > ostream& operator <<(ostream& OutPutStream,Address& AnAddress)*
- > *
- > ***************************************************************
- >
- > {
- > OutPutStream<<"Street : "<<AnAddress.Number<<" "<<AnAddress.Street<<EOLN;
- > OutPutStream<<"City : "<<AnAddress.City<<EOLN;
- > OutPutStream<<"Zip code : "<<AnAddress.Zip<<EOLN;
- > }
-
- I am not familiar with the command EOLN... I think you want to use
- endl instead...
-